<?php defined('BASEPATH') OR exit('No direct script access allowed');

class Migration_CreateTable_WeiboInfo extends CI_Migration
{
    public function up()
    {
        $this->dbforge->add_field('id');
        $this->dbforge->add_field(array(
            'user_id'     => array('type' => 'INT',     'constraint' => '9',),
            'name'        => array('type' => 'VARCHAR', 'constraint' => '20',  'null' =>TRUE,),
            'token'       => array('type' => 'VARCHAR', 'constraint' => '16',  'null' => TRUE,),
            'weibo_id'    => array('type' => 'INT',     'constraint' => '20',  'null' => TRUE,),
            'photos'      => array('type' => 'VARCHAR', 'constraint' => '100', 'null' => TRUE,),
            'gender'      => array('type' => 'VARCHAR', 'constraint' => '2',   'null' =>TRUE,),
            'description' => array('type' => 'VARCHAR', 'constraint' => '200', 'null' => TRUE,),
            'data_json'   => array('type' => 'TEXT',    'null'       => TRUE,),
        ));
        $this->dbforge->add_key('token');
        $this->dbforge->add_key('weibo_id');
        $this->dbforge->create_table('WeiboInfo');
    }

    public function down()
    {
        $this->dbforge->drop_table('WeiboInfo');
    }
} 